package com.atguigu.product.controller;

import com.atguigu.product.bean.Product;
import com.atguigu.product.service.ProductService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.concurrent.TimeUnit;

@Slf4j
//@RequestMapping("/api/product/")
@RestController
public class ProductController {

    @Resource
    ProductService productService;

    @GetMapping("getProduct/{id}")
     public Product getProduct(@PathVariable("id") Long id,
                               HttpServletRequest request){
        String token = request.getHeader("X-Token");
        log.info("hello....token:{}",token);
        Product product = productService.getProduct(id);
        return product;
    }
}
